<template>
    <div :class="{ 'ly-is-full': isFull }">
      <div class="tableSelect" ref="tableSelect">
        <div v-show="searchMoreType">
          <personnelScreen
            :formInline="formInline"
            ref="RefScreen"
            :is_daike="false"
          ></personnelScreen>
        </div>
        <el-form
          :inline="true"
          :model="formInline"
          label-position="right"
          label-width="170px"
        >
          <el-row :gutter="20" type="flex">
              <el-col :span="20">
              <el-form-item label-width="170">
                <el-input
                  v-model.trim="formInline.school_name"
                  placeholder="请输入学校名称"
                  style="width: 300px"
                ></el-input>
                <el-button @click="search" type="primary" icon="Search"
                  >查询</el-button
                ></el-form-item
              >
              <el-form-item label=""
                ><el-button @click="handleEdit('', 'reset')" icon="Refresh"
                  >重置</el-button
                ></el-form-item
              >
              <el-form-item label=""
                ><el-button
                  @click="addModule"
                  type="primary"
                  v-if="authority([1, 3])"
                  >添加</el-button
                ></el-form-item
              >
              <el-form-item label=""
                ><el-button
                  @click="handleDelete"
                  type="danger"
                  v-if="authority([1, 3])"
                  >删除</el-button
                ></el-form-item
              >
              <el-form-item label=""
                ><el-button @click="exportText" type="primary"
                  >导出</el-button
                ></el-form-item
              >
               
              <el-form-item label=""
                ><el-button v-if="authority([4])" type="" @click="handleOut"
                  >选择外出</el-button
                ></el-form-item
              >
            </el-col>
  
            <el-form-item prop="school_name">
              <el-button
                v-if="searchMoreType"
                @click="searchMore"
                type="primary"
                icon="Minus"
                style="margin-left: 20px"
                >收回查询</el-button
              >
  
              <el-button
                v-if="!searchMoreType"
                @click="searchMore"
                type="primary"
                icon="Aim"
                style="margin-left: 20px"
                >查询更多</el-button
              >
            </el-form-item>
          </el-row>
  
          <!-- <el-form-item label=""><el-button @click="handleDelete" type="danger" :disabled="multiple" v-show="isShowBtn('goodsType','商品分类','Delete')">删除</el-button></el-form-item> -->
        </el-form>
      </div>
  
      <div class="table">
        <el-table
          :height="tableHeight"
          border
          :data="tableData"
          v-loading="loadingPage"
          style="width: 100%"
          ref="tableref"
          @selection-change="handleSelectionChange"
          row-key="id"
          :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
        >
          <!--                <el-table-column type="selection" width="55"></el-table-column>-->
          <el-table-column
            type="selection"
            width="60"
            align="center"
          ></el-table-column>
          <el-table-column type="index" width="60" align="center" label="序号">
            <template #default="scope">
              <span v-text="getIndex(scope.$index)"></span>
            </template>
          </el-table-column>
          <el-table-column
            min-width="100"
            prop="class_session_status"
            label="课节状态"
          >
            <template #default="scope">
              <div v-if="authority([4])">
                <el-tag type="primary" v-if="scope.row.class_session_status == '1'"
                >已开课</el-tag
              >
              <el-tag type="danger" v-else-if="scope.row.class_session_status == '2'"
                >异常</el-tag
              >
              <el-tag type="warning" v-else
                >未开课</el-tag
              >
              </div>
              <div v-else>
                <el-tag type="primary" v-if="scope.row.class_session_status == '1'"
                >已完成</el-tag
              >
              <el-tag type="danger" v-else-if="scope.row.class_session_status == '2'"
                >异常</el-tag
              >
              <el-tag type="warning" v-else
                >待完成</el-tag
              >
              </div>
            </template>
          </el-table-column>
          <!-- 修改排序 开始 -->
          <el-table-column
            min-width="100"
            prop="province"
            label="省"
          ></el-table-column>
  
          <el-table-column
            min-width="100"
            prop="municipality"
            label="市"
          ></el-table-column>
          <el-table-column
            min-width="100"
            prop="region"
            label="区"
          ></el-table-column>
          <el-table-column
            min-width="200"
            prop="institution"
            label="所属机构"
          ></el-table-column>
          <el-table-column
            min-width="150"
            prop="school_name"
            label="学校名称"
          ></el-table-column>
          <el-table-column
            min-width="100"
            prop="grade"
            label="年级"
          ></el-table-column>
  
          <el-table-column
            min-width="100"
            prop="calss"
            label="班级"
          ></el-table-column>
          <el-table-column
            min-width="150"
            prop="subject"
            label="科目"
          ></el-table-column>
          <el-table-column
            min-width="200"
            prop="course"
            label="课程"
          ></el-table-column>
          <el-table-column
            min-width="130"
            prop="teaching_mode"
            label="授课模式"
          ></el-table-column>
          <el-table-column
            min-width="130"
            prop="class_session_name"
            label="课节次名称"
          ></el-table-column>
          <el-table-column
            min-width="150"
            prop="calss_time"
            label="上课日期"
          ></el-table-column>
          <el-table-column
            min-width="100"
            prop="calss_time_slot"
            label="上课时间"
          ></el-table-column>
          <el-table-column
            min-width="100"
            prop="calss_time_last"
            label="下课时间"
          ></el-table-column>
          <el-table-column
            min-width="100"
            prop="volunteer_name"
            label="上课志愿者"
          ></el-table-column>
          <!-- 在此填写志愿者归属小队 开始 -->
          <el-table-column
            min-width="150"
            prop="team"
            label="志愿者归属小队"
          ></el-table-column>
          <!-- 在此填写志愿者归属小队 结束 -->
          <el-table-column
            min-width="100"
            prop="volunteer_stauts"
            label="志愿者考勤"
          >
            <template #default="scope">
              <el-tag type="primary" v-if="scope.row.volunteer_stauts == '1'"
                >正常</el-tag
              >
              <el-tag type="danger" v-else-if="scope.row.volunteer_stauts == '2'"
                >异常</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column
            min-width="100"
            prop="local_teachers"
            label="在地教师"
          ></el-table-column>
          <el-table-column
            min-width="130"
            prop="local_teachers_status"
            label="在地教师考勤"
          >
            <template #default="scope">
              <el-tag type="primary" v-if="scope.row.local_teachers_status == '1'"
                >正常</el-tag
              >
              <el-tag
                type="danger"
                v-else-if="scope.row.local_teachers_status == '2'"
                >异常</el-tag
              >
            </template>
          </el-table-column>
         
          <el-table-column
            min-width="100"
            prop="abnormal_cause"
            label="异常原因"
          ></el-table-column>
          <el-table-column min-width="130" prop="link" label="课程会议链接">
            <template #default="scope">
              <a :href="scope.row.link" style="color: blue" target="_blank">
                <el-button type="primary">观看课程</el-button>
              </a>
            </template>
          </el-table-column>
          <el-table-column
            min-width="130"
            prop="code"
            label="课程会议号"
          ></el-table-column>
          <el-table-column
            min-width="200"
            prop="zxguser_name"
            label="督课人员"
          ></el-table-column>
          <!-- 修改排序 结束 --> 
          <el-table-column
            min-width="200"
            prop="zdquser_name"
            label="在地区域负责人"
          ></el-table-column>
          <el-table-column
            min-width="200"
            prop="user_name"
            label="在地工作人员"
          ></el-table-column>
         
          
  
          <el-table-column min-width="100" prop="status" label="是否代课">
            <template #default="scope">
              <el-tag type="primary" v-if="scope.row.is_daike == '1'"
                >无代课</el-tag
              >
              <el-tag type="danger" v-if="scope.row.is_daike == '2'">代课</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            min-width="200"
            prop="duser_name"
            label="代课人员"
          ></el-table-column>
          <el-table-column min-width="200" prop="daike_remarks" label="代课原因">
            <template #default="scope">
              <el-tag type="primary" v-if="scope.row.is_daike == '1'"
                >无代课</el-tag
              >
              <span v-else>{{ scope.row.daike_remarks || "无" }}</span>
            </template>
          </el-table-column>
          <!-- is_waichu -->
          <el-table-column min-width="100" prop="is_pause" label="是否暂停">
            <template #default="scope">
              <el-tag type="primary" v-if="scope.row.is_pause == '1'"
                >未暂停</el-tag
              >
              <el-tag type="danger" v-if="scope.row.is_pause == '2'">暂停</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            min-width="160"
            prop="pause_remarks"
            label="暂停原因"
          ></el-table-column>
          <el-table-column min-width="100" prop="is_pause" label="是否外出">
            <template #default="scope">
              <el-tag type="primary" v-if="scope.row.is_waichu == '1'"
                >正常</el-tag
              >
              <el-tag type="danger" v-if="scope.row.is_waichu == '2'"
                >外出</el-tag
              >
            </template>
          </el-table-column> 
          
          <el-table-column min-width="200"  label="首课图片">
            <template #default="scope">
              <img
                v-if="scope.row.frist_image"
                :src="scope.row.frist_image"
                alt=""
                style="width: 30px; height: 30px"
                @click="imageShows(scope.row)"
              />
            </template>
          </el-table-column>
          
          <el-table-column
            min-width="200"
            prop="remarks"
            label="督课人员备注"
          ></el-table-column>
          <el-table-column
            min-width="200"
            prop="zremarks"
            label="在地人员备注"
          ></el-table-column>
  
          <!-- 未暂停/前往通知/已通知 -->
          <el-table-column label="操作" width="180" fixed="right">
            <template #header>
              <div
                style="
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                "
              >
                <div>操作</div>
                <div @click="setFull">
                  <el-tooltip content="全屏" placement="bottom">
                    <el-icon><full-screen /></el-icon>
                  </el-tooltip>
                </div>
              </div>
            </template>
            <template #default="scope">
              <span
                class="table-operate-btn"
                @click="shokesedit(scope.row)"
                v-if="authority([5])&& scope.row.is_image == 1"
                >首课上传</span
              >
              <!-- <span class="table-operate-btn" @click="handleEdit(scope.row,'detail')" v-show="isShowBtn('viptypeManage','会员卡管理','Retrieve')">详情</span> -->
              <span
                class="table-operate-btn"
                @click="handleEdit(scope.row, 'edit')"
                v-if="authority([5])"
                >督课信息填写</span
              >
  
              <span
                class="table-operate-btn"
                @click="handleEdit(scope.row, 'edit')"
                v-if="authority([4])"
                >在地编辑</span
              >
              <el-text
                type="danger"
                v-if="authority([4]) && scope.row.is_waichu == 2"
                >当前外出</el-text
              >
              <span
                class="table-operate-btn"
                @click="waichuet(scope.row, 'edit')"
                v-if="authority([4]) && scope.row.is_waichu == 1"
                >选择外出</span
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 首课 -->
      <shoke ref="shokeModuleFlag" @getData="refreshData" ></shoke>
      <Pagination
        v-bind:child-msg="pageparm"
        @callFather="callFather"
      ></Pagination>
  
      <add-module-goods-type
        ref="addModuleFlag"
        @refreshData="refreshData"
        :type="type"
      ></add-module-goods-type>
      <waichuaddVue
        ref="waichuaddModuleFlag"
        @refreshData="refreshData"
      ></waichuaddVue>
      <el-dialog
        title="备注"
        v-model="inSchooleTextVis"
        width="700"
        @close="diaClose"
      >
        <el-form :model="addSchoolPlanForm">
          <el-form-item label="备注" :label-width="100">
            <el-input
              v-model="formInline.mark"
              style="width: 440px"
              :rows="2"
              type="textarea"
              placeholder="请输入备注"
            />
          </el-form-item>
        </el-form>
  
        <template #footer>
          <el-button @click="handleClose" :loading="loadingSave">取消</el-button>
          <el-button
            type="primary"
            @click="submitDataS"
            :loading="loadingSave"
            :disabled="loadingTitle == '详情'"
            >确定</el-button
          >
        </template>
      </el-dialog>
      <el-dialog v-model=" imagsShow" :destroy-on-close="true">
          <img  style="width: 100%;" :src=" imageUrl" alt="Preview Image" />
        </el-dialog>
    </div>
  </template>
  <script>
  import Pagination from "@/components/Pagination.vue";
  import { dateFormats } from "@/utils/util";
  import {
    timetableList,
    timetableDel,
    adminGroup,
    timetableImport,
    schewaichu,
  } from "@/api/api";
  import XEUtils from "xe-utils";
  import AddModuleGoodsType from "./components/add.vue";
  import shoke from "./components/shoke.vue";
  import { setStorage, getStorage } from "@/utils/util";
  import { lyMixins } from "@/mixins/mixins";
  import dayjs from "dayjs";
  import axios from "axios";
  import waichuaddVue from "./components/waichuadd.vue";
  import personnelScreen from "@/components/personnelScreen/personnelScreen.vue";
  import { ElMessage, ElMessageBox, ElLoading } from "element-plus";
  
  export default {
    mixins: [lyMixins],
    components: {
      AddModuleGoodsType,
      waichuaddVue,
      personnelScreen,
      Pagination,
      shoke
    },
    name: "adminManage",
    data() {
      return {
        imagsShow:false,
        imageUrl:'',
        userInfoobjs: {}, //用户对象
        userInfo: "",
        inSchooleTextVis: false,
        searchMoreType: false,
  
        type: "",
        fileList: [],
        isFull: false,
        loadingPage: false,
        // 选项框选中数组
        ids: [],
  
        // 选项框非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        formInline: {
          page: 1,
          page: 1,
          per_page: 10,
          mark: "",
        },
        pageparm: {
          page: 1,
          per_page: 10,
          total: 0,
        },
        statusList: [
          { id: 1, name: "正常" },
          { id: 0, name: "禁用" },
        ],
        timers: [],
        tableData: [],
        selectData: [],
        GroupList: [], //管理员分组列表
        class_session_status: [
          {
            value: "1",
            label: "正常",
          },
          {
            value: "2",
            label: "异常",
          },
        ],
        class_status: [
          {
            value: "1",
            label: "正常",
          },
          {
            value: "2",
            label: "异常",
          },
        ],
        volunteer_stauts: [
          {
            value: "1",
            label: "正常",
          },
          {
            value: "2",
            label: "异常",
          },
        ],
        is_pauseList: [
          {
            value: "1",
            label: "未暂停",
          },
          {
            value: "2",
            label: "暂停",
          },
        ],
        userInfo: "", //用户权限字段
      };
    },
    methods: {
      imageShows(row){
        this.imagsShow=true;
        this.imageUrl=row.frist_image;
      },
      shokesedit(row){
        // 首课上传
        this.$refs.shokeModuleFlag.addPlan(row);
      },
      authority(groupArr = [0]) {
        // 权限筛选
        let userInfo = this.userInfo;
        // 当前权限和传来的权限组进行对比
        if (groupArr.some((item) => Number(item) === userInfo)) return true;
        return false;
      },
      isClose() {
        this.$confirm("是否已完成通知老师上课?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            ElMessage({
              type: "success",
              message: "通知成功!",
            });
          })
          .catch(() => {
            ElMessage({
              type: "info",
              message: "已取消",
            });
          });
      },
      notice() {
        this.inSchooleTextVis = true;
      },
      handleClose() {
        this.inSchooleTextVis = false;
      },
      submitDataS() {
        this.inSchooleTextVis = false;
      },
      searchMore() {
        this.searchMoreType = !this.searchMoreType;
      },
      exportText(e) {
        if (this.ids.length == 0) {
          ElMessage.error("请先选择导出数据");
          return;
        }
        axios({
          url: this.$config.API_URL + "timetable/export/",
          method: "post", //请求方法
          responseType: "blob", //表示接受服务器返回的二进制流
          data: {
            id: this.ids,
          },
        })
          .then((res) => {
            console.log(res);
  
            let blob = new Blob([res.data], { type: "application/vnd.ms-excel" });
            let fileName = "督课管理表"; // 自定义文件名
            if (window.navigator && window.navigator.msSaveOrOpenBlob) {
              // IE兼容
              window.navigator.msSaveOrOpenBlob(blob, fileName);
            } else {
              let objectUrl = (window.URL || window.webkitURL).createObjectURL(
                blob
              );
              let downloadLink = document.createElement("a");
              downloadLink.href = objectUrl;
              downloadLink.download = fileName;
              document.body.appendChild(downloadLink);
              downloadLink.click();
              document.body.removeChild(downloadLink);
              window.URL.revokeObjectURL(objectUrl); // 释放URL对象
            }
          })
          .catch((error) => {
            ElMessage.error("导出失败");
          });
      },
      formatDateTime(time) {
        return dayjs.unix(time).format("YYYY-MM-DD HH:mm");
      },
      refreshData(x) {
        // 新增成功 搜索归0
        if (x) this.handleEdit("", "reset");
        else this.getData();
      },
      setFull() {
        this.isFull = !this.isFull;
        window.dispatchEvent(new Event("resize"));
      },
      // 表格序列号
      getIndex($index) {
        // (当前页 - 1) * 当前显示数据条数 + 当前行数据的索引 + 1
        return (this.pageparm.page - 1) * this.pageparm.per_page + $index + 1;
      },
      //多选项框被选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map((item) => item.id);
        this.single = selection.length !== 1;
        this.multiple = !selection.length;
      },
      waichuet(row) {
        let vm = this;
        vm.$confirm("是否确认外出选中的数据项?", "外出确定", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(function () {
          return schewaichu({ id: row.id }).then((res) => {
            if (res.code == 1) {
              ElMessage.success(res.msg);
              vm.search();
            } else {
              ElMessage.warning(res.msg);
            }
          });
        });
      },
      // 批量外出操作
      handleOut() {
        const ids = this.ids;
        if (ids.length == 0) {
          ElMessage.warning("请选择要外出数据");
          return;
        }
        let vm = this;
        vm.$confirm("是否确认外出选中的数据项?", "外出确定", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(function () {
          return schewaichu({ ids: ids }).then((res) => {
            if (res.code == 1) {
              ElMessage.success(res.msg);
              vm.search();
            } else {
              ElMessage.warning(res.msg);
            }
          });
        });
      },
      /** 批量删除按钮操作 */
      handleDelete(row) {
        const ids = this.ids;
        if (ids.length == 0) {
          ElMessage.warning("请选择要删除数据");
          return;
        }
        let vm = this;
        vm.$confirm("是否确认删除选中的数据项?", "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(function () {
          return timetableDel({ ids: ids }).then((res) => {
            if (res.code == 1) {
              ElMessage.success(res.msg);
              vm.search();
            } else {
              ElMessage.warning(res.msg);
            }
          });
        });
      },
      changeStatus(row) {
        console.log(row, "row----");
      },
      addModule() {
        console.log(this.GroupList, "---------新增出发");
        this.type = "add";
        this.$refs.addModuleFlag.addModuleFn(null, "新增", this.GroupList);
      },
      handleEditdk(row) {
        // 代课
        console.log("点击代课");
        this.$refs.addModuleFlagDk.addModuleFn(row, "代课");
      },
      handleEditduke(row) {
        // 转交督课
        this.$refs.addModuleFlagDuke.addModuleFn(row, "督课转交");
      },
      waichuEdit(row) {
        // 外出编辑
        this.$refs.waichuaddModuleFlag.addModuleFn(
          row,
          "外出选择",
          this.GroupList
        );
      },
      handleEdit(row, flag) {
        if (flag == "detail") {
          this.$refs.addModuleFlag.addModuleFn(row, "详情", this.GroupList);
        } else if (flag == "edit") {
          this.type = "edit";
          this.$refs.addModuleFlag.addModuleFn(row, "编辑", this.GroupList);
        } else if (flag == "delete") {
          let vm = this;
          vm.$confirm("您确定要删除选中的数据吗？", {
            closeOnClickModal: false,
          })
            .then((res) => {
              timetableDel({ id: row.id }).then((res) => {
                if (res.code == 1) {
                  ElMessage.success(res.msg);
                  vm.search();
                } else {
                  ElMessage.warning(res.msg);
                }
              });
            })
            .catch(() => {});
        } else if (flag == "reset") {
          // 清空组件
          this.$refs.RefScreen.reset();
          this.formInline = {
            page: 1,
            per_page: 10,
          };
          this.pageparm = {
            page: 1,
            per_page: 10,
            total: 0,
          };
          this.getData();
        }
      },
  
      callFather(parm) {
        this.formInline.page = parm.page;
        this.formInline.per_page = parm.per_page;
        this.getData();
      },
      search(i, e) {
        this.formInline.page = 1;
        this.formInline.per_page = 10;
        let objs = this.$refs.RefScreen.returned();
        this.formInline = { ...this.formInline, ...objs };
        this.getData();
      },
      //获取列表
      async getData() {
        this.loadingPage = true;
  
        // 条件判断
        if (this.authority([5])){
            this.formInline.is_daike = 2;
        }
        if (this.authority([5]))
          this.formInline.zxguser_id = this.userInfoobjs.id; //在线工作人员
        if (this.authority([4])) this.formInline.user_id = this.userInfoobjs.id; //在地工作
        // console.log(this.formInline,'---------------formInline')
        timetableList(this.formInline).then((res) => {
          this.loadingPage = false;
          if (res.code == 1) {
            this.tableData = res.data.data;
            // // 将列表数据转换为树形数据
            // this.tableData = XEUtils.toArrayTree(res.data.data, { parentKey: 'parent', strict: false })
            this.pageparm.page = res.data.current_page;
            this.pageparm.per_page = res.data.per_page;
            this.pageparm.total = res.data.total;
          }
        });
      },
  
      timeChange(val) {
        if (val) {
          this.formInline.beginAt = dateFormats(val[0], "yyyy-MM-dd hh:mm:ss");
          this.formInline.endAt = dateFormats(val[1], "yyyy-MM-dd hh:mm:ss");
        } else {
          this.formInline.beginAt = null;
          this.formInline.endAt = null;
        }
        this.search();
      },
      getGroupList() {
        // 管理员分组获取
        adminGroup().then((res) => {
          if (res.code == 1) {
            //console.log(res, "------------成功获取到管理员分组列表");
            this.GroupList = res.data;
          }
        });
      },
  
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      },
      beforeUpload(file) {
        // 显示加载状态
        this.loadingInstance = ElLoading.service({
          lock: true,
          text: "正在上传...",
          background: "rgba(0, 0, 0, 0.7)",
        });
        return true;
      },
      handleSuccess(res, file) {
        if (res.code == 1) {
          timetableImport({ file: res.data.url })
            .then((ress) => {
              if (ress.code == 1) {
                this.getData();
                if (fileList[fileList.length - 1].uid == file.uid) {
                  this.loadingInstance.close(); //关闭全局加载
                  ElMessage.success(ress.msg);
                }
              } else {
                ElMessage.error(ress.msg || "导入失败");
                ElMessage.error(
                  ress.msg || "导入失败" + "文件名：" + file.name
                );
              }
            })
            .catch((error) => {
              ElMessage.error("上传失败");
              this.loadingInstance.close(); //关闭全局加载
            });
        }
        if (fileList[fileList.length - 1].uid == file.uid) {
          this.loadingInstance.close(); //关闭全局加载
        }
      },
      handleError(err, file, fileList) {
        this.loadingInstance.close(); //关闭全局加载
      },
      handleExceed(files, fileList) {
        console.log(files, fileList);
        return;
        ElMessage.warning(
          `当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
            files.length + fileList.length
          } 个文件`
        );
      },
      beforeRemove(file, fileList) {
        return this.$confirm(`确定移除 ${file.name}？`);
      },
      // 文件状态改变时
      handleChange(file) {
        // 结构获取文件名
        let { name } = file;
        // 正则校验文件格式
        let result = /^.xls|.png|.xlsx$/.test(
          // 截取文件名后缀 例：.zip
          // 注解：
          // substring() 截取字符串中介于两个指定下标之间的字符
          // toLowerCase()  将字符串转换为小写
          // lastIndexOf(".") 返回一个指定的字符串值最后出现的位置
          name.substring(name.lastIndexOf(".")).toLowerCase()
        );
        if (!result) {
          ElMessage.error("上传文件格式不符合要求");
          return;
        }
      },
    },
    created() {
      this.userInfo = Number(JSON.parse(getStorage("groupId"))); //权限
      this.userInfoobjs = JSON.parse(getStorage("userinfo"));
      let seobjs = this.$route.query;
      this.formInline = {...this.formInline,...seobjs};
      // 获取管理员分组
      this.getGroupList();
      // 数据获取
      this.getData();
    },
    mounted() {
      this.$nextTick(() => {
      let seobjs = this.$route.query;
  
        this.$refs.RefScreen.formInline = seobjs;
      });
    },
    
  };
  </script>
  